<template>
    <!-- 添加或修改采购订单行项目信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" v-dialogDrag>
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-tabs v-model="activeName" class="detail-tab" type="card">
                <el-tab-pane label="基本信息" name="first">
                    <el-row :gutter="20">
                        <el-col :span="12">
                            <el-form-item label="备注" prop="remark">
                                <el-input v-model="form.remark" placeholder="请输入备注"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="删除标志" prop="delFlag">
                                <el-input v-model="form.delFlag" placeholder="请输入删除标志"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购订单编码" prop="poNo">
                                <el-input v-model="form.poNo" placeholder="请输入采购订单编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购订单行项目号" prop="poItemNo">
                                <el-input v-model="form.poItemNo" placeholder="请输入采购订单行项目号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购订单行项目id" prop="poItemId">
                                <el-input v-model="form.poItemId" placeholder="请输入采购订单行项目id"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="种类编码" prop="subclassCode">
                                <el-input v-model="form.subclassCode" placeholder="请输入种类编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="种类名称" prop="subclassName">
                                <el-input v-model="form.subclassName" placeholder="请输入种类名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同编号" prop="conCode">
                                <el-input v-model="form.conCode" placeholder="请输入合同编号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同名称" prop="conName">
                                <el-input v-model="form.conName" placeholder="请输入合同名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购方公司名称" prop="buyerName">
                                <el-input v-model="form.buyerName" placeholder="请输入采购方公司名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购方公司编码" prop="buyerCode">
                                <el-input v-model="form.buyerCode" placeholder="请输入采购方公司编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购方物料编码" prop="materialCode">
                                <el-input v-model="form.materialCode" placeholder="请输入采购方物料编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购方物料描述" prop="materialDesc">
                                <el-input v-model="form.materialDesc" placeholder="请输入采购方物料描述"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购数量" prop="amount">
                                <el-input v-model="form.amount" placeholder="请输入采购数量"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同编号" prop="sellerConCode">
                                <el-input v-model="form.sellerConCode" placeholder="请输入合同编号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="技术规范流水号" prop="serialNumber">
                                <el-input v-model="form.serialNumber" placeholder="请输入技术规范流水号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同签订日期" prop="sellerSignTime">
                                <el-input v-model="form.sellerSignTime" placeholder="请输入合同签订日期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="项目编号" prop="prjCode">
                                <el-input v-model="form.prjCode" placeholder="请输入项目编号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="工程项目名称" prop="prjName">
                                <el-input v-model="form.prjName" placeholder="请输入工程项目名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资编码" prop="matCode">
                                <el-input v-model="form.matCode" placeholder="请输入物资编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购技术固化ID" prop="fixedTechid">
                                <el-input v-model="form.fixedTechid" placeholder="请输入采购技术固化ID"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同包号" prop="pkgNo">
                                <el-input v-model="form.pkgNo" placeholder="请输入合同包号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="招标批次号" prop="bidBatCode">
                                <el-input v-model="form.bidBatCode" type="textarea" placeholder="请输入内容"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="24">
                            <el-form-item label="固化ID描述" prop="extDes">
                                <el-input v-model="form.extDes" type="textarea" placeholder="请输入内容"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资大类编码" prop="matMaxCode">
                                <el-input v-model="form.matMaxCode" placeholder="请输入物资大类编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资中类编码" prop="matMedCode">
                                <el-input v-model="form.matMedCode" placeholder="请输入物资中类编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资小类编码" prop="matMinCode">
                                <el-input v-model="form.matMinCode" placeholder="请输入物资小类编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资大类名称" prop="matMaxName">
                                <el-input v-model="form.matMaxName" placeholder="请输入物资大类名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资中类名称" prop="matMedName">
                                <el-input v-model="form.matMedName" placeholder="请输入物资中类名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="物资小类名称" prop="matMinName">
                                <el-input v-model="form.matMinName" placeholder="请输入物资小类名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="虚拟订单标识" prop="virFlag">
                                <el-input v-model="form.virFlag" placeholder="请输入虚拟订单标识"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同生效日期" prop="conValidTime">
                                <el-input v-model="form.conValidTime" placeholder="请输入合同生效日期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同父子ID" prop="parentConId">
                                <el-input v-model="form.parentConId" placeholder="请输入合同父子ID"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同ID" prop="conId">
                                <el-input v-model="form.conId" placeholder="请输入合同ID"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="支付比例" prop="payRate">
                                <el-input v-model="form.payRate" placeholder="请输入支付比例"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="分包编码" prop="bidpkgCode">
                                <el-input v-model="form.bidpkgCode" placeholder="请输入分包编码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="招标批次" prop="purprjCode">
                                <el-input v-model="form.purprjCode" placeholder="请输入招标批次"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="招标计划名称" prop="purprjName">
                                <el-input v-model="form.purprjName" placeholder="请输入招标计划名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="分标名称" prop="subbidName">
                                <el-input v-model="form.subbidName" placeholder="请输入分标名称"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="供货单编号" prop="suppMatMode">
                                <el-input v-model="form.suppMatMode" placeholder="请输入供货单编号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同最终交货期" prop="cfmDlvTime">
                                <el-input v-model="form.cfmDlvTime" placeholder="请输入合同最终交货期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="合同计划交货日期" prop="dlvTime">
                                <el-input v-model="form.dlvTime" placeholder="请输入合同计划交货日期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="实际收货地址" prop="realRecvAddr">
                                <el-input v-model="form.realRecvAddr" placeholder="请输入实际收货地址"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="预计发货期" prop="planDistTime">
                                <el-input v-model="form.planDistTime" placeholder="请输入预计发货期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="预计到货期" prop="planAccpTime">
                                <el-input v-model="form.planAccpTime" placeholder="请输入预计到货期"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="收货联系人" prop="recvContact">
                                <el-input v-model="form.recvContact" placeholder="请输入收货联系人"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="联系人固定电话" prop="contactTel">
                                <el-input v-model="form.contactTel" placeholder="请输入联系人固定电话"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购申请号" prop="purreqCode">
                                <el-input v-model="form.purreqCode" placeholder="请输入采购申请号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="采购申请行号" prop="purreqItemCode">
                                <el-input v-model="form.purreqItemCode" placeholder="请输入采购申请行号"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="交货方式" prop="dlvMode">
                                <el-input v-model="form.dlvMode" placeholder="请输入交货方式"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="变更数量" prop="chgQty">
                                <el-input v-model="form.chgQty" placeholder="请输入变更数量"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="变更后数量" prop="chgUpdQty">
                                <el-input v-model="form.chgUpdQty" placeholder="请输入变更后数量"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="变更后金额" prop="chgConAmt">
                                <el-input v-model="form.chgConAmt" placeholder="请输入变更后金额"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="是否变更" prop="isChanged">
                                <el-input v-model="form.isChanged" placeholder="请输入是否变更"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="联系人手机" prop="contactMobile">
                                <el-input v-model="form.contactMobile" placeholder="请输入联系人手机"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="更新时间" prop="modifyTime">
                                <el-input v-model="form.modifyTime" placeholder="请输入更新时间"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="每页条数" prop="pageSize">
                                <el-input v-model="form.pageSize" placeholder="请输入每页条数"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="当前页码" prop="pageNum">
                                <el-input v-model="form.pageNum" placeholder="请输入当前页码"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="页数" prop="pageCount">
                                <el-input v-model="form.pageCount" placeholder="请输入页数"/>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="总记录数" prop="total">
                                <el-input v-model="form.total" placeholder="请输入总记录数"/>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-tab-pane>
            </el-tabs>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import { addAction, getById, updateAction } from '@/api/manage';
    import moment from 'moment';

    export default {
        name: "FactoryPurchaseMainColumnForm",
        data() {
            return {
                // 遮罩层
                loading: true,
                activeName: "first",
                // 弹出层标题
                title: "",
                // 是否显示弹出层
                open: false,
                // 表单参数
                form: {},
                // 表单校验
                rules: {
                },
                url: {
                    getById:'/factoryPurchaseMainColumn/factoryPurchaseMainColumn/',
                    add:'/factoryPurchaseMainColumn/factoryPurchaseMainColumn/add',
                    edit:'/factoryPurchaseMainColumn/factoryPurchaseMainColumn/edit',
                },
            };
        },
        created() {

        },
        methods: {
            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 表单重置
            reset() {
                this.form = {
            id: null,
        status: "0",
            remark: null,
            createBy: null,
            createTime: null,
            updateBy: null,
            updateTime: null,
            delFlag: null,
            poNo: null,
            poItemNo: null,
            poItemId: null,
            subclassCode: "60004",
            subclassName: null,
            conCode: null,
            conName: null,
            buyerName: null,
            buyerCode: null,
            materialCode: null,
            materialDesc: null,
            amount: null,
            sellerConCode: null,
            serialNumber: null,
            sellerSignTime: null,
            conType: null,
            prjCode: null,
            prjName: null,
            matCode: null,
            fixedTechid: null,
            pkgNo: null,
            bidBatCode: null,
            extDes: null,
            matMaxCode: null,
            matMedCode: null,
            matMinCode: null,
            matMaxName: null,
            matMedName: null,
            matMinName: null,
            virFlag: null,
            conValidTime: null,
            parentConId: null,
            conId: null,
            payRate: null,
            bidpkgCode: null,
            purprjCode: null,
            purprjName: null,
            subbidName: null,
            suppMatMode: null,
            cfmDlvTime: null,
            dlvTime: null,
            realRecvAddr: null,
            planDistTime: null,
            planAccpTime: null,
            recvContact: null,
            contactTel: null,
            purreqCode: null,
            purreqItemCode: null,
            dlvMode: null,
            chgQty: null,
            chgUpdQty: null,
            chgConAmt: null,
            chgType: null,
            isChanged: null,
            contactMobile: null,
            modifyTime: null,
            pageSize: null,
            pageNum: null,
            pageCount: null,
            total: null
                };
                this.resetForm("form");
            },
            /** 新增按钮操作 */
            handleAdd() {
                this.reset();
                this.open = true;
                this.title = "添加采购订单行项目信息";
            },
            /** 修改按钮操作 */
            handleUpdate(row) {
                this.reset();
                const id = row.id || this.ids;
                getById(this.url.getById, id).then(response => {
                    this.form = response.data;
                    this.open = true;
                    this.title = "修改采购订单行项目信息";
                });
            },
            /** 提交按钮 */
            submitForm() {
                this.$refs["form"].validate(valid => {
                    if (valid) {
                        if (this.form.id != null) {
                            updateAction(this.url.edit, this.form).then(response => {
                                this.$modal.msgSuccess("修改成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        } else {
                            addAction(this.url.add, this.form).then(response => {
                                this.$modal.msgSuccess("新增成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        }
                    }
                });
            },
        }
    };
</script>
